import { defineStore } from "pinia";
import { type ILocalAudioTrack } from "agora-rtc-sdk-ng";
/**
 * 本地音频轨道管理（浅层响应式）
 * @property mic - 麦克风输入轨道
 * @property system - 系统音频捕获轨道
 */
interface AudioTracks {
  mic?: ILocalAudioTrack;
  system?: ILocalAudioTrack;
}
export const useAudioStore = defineStore("audio", {
  state: (): AudioTracks => ({
    mic: undefined,
    system: undefined,
  }),
  actions: {
    /**
     *@description 改变麦克风状态
     */
    setMic(audioTrack: ILocalAudioTrack | undefined) {
      this.mic = audioTrack;
    },
    /**
     *@description 改变系统音频状态
     */
    setSystem(audioTrack: ILocalAudioTrack | undefined) {
      this.system = audioTrack;
    },
  },
});
